package com.avego.game;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * Hello world!
 * 
 */
public class App
{
	public static void main(String[] args)
	{
		int numPlayers = 10;

		ApplicationContext appContext = new ClassPathXmlApplicationContext(
				new String[] { "spring_aop.xml" });

		Game game = (Game) appContext.getBean("game");

		Player player;

		for (int i = 0; i < numPlayers; i++)
		{
			player = (Player) appContext.getBean("player");
			player.setPlayerNumber(i);
			game.addPlayer(player);
		}

		try
		{
			game.gameOn();
		}
		catch (InterruptedException e)
		{
			e.printStackTrace();
		}

		System.out.println("OK!!");
	}
}
